package com.minimalist.common.entity.lindi.po;

import com.minimalist.common.config.mybatis.InsertFullColumnHandler;
import com.minimalist.common.config.mybatis.UpdateFullColumnHandler;
import com.minimalist.common.config.mybatis.bo.BaseEntity;
import com.mybatisflex.annotation.Table;

import java.io.Serial;
import java.io.Serializable;
import java.util.Objects;

/**
 * 林地指标交易平台_购买申请镇街购买项 实体类。
 *
 * @author 11987
 * @since 2025-07-01
 */
@Table(value = "LINDI_PURCHASE_APPLICATION_TOWN_ITEM", onInsert = InsertFullColumnHandler.class, onUpdate = UpdateFullColumnHandler.class)
public class LindiPurchaseApplicationTownItem extends BaseEntity implements Serializable{

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 购买申请ID
     */
    private Long purchaseApplicationId;

    /**
     * 镇街项ID
     */
    private Long townItemId;

    /**
     * 镇街名称
     */
    private String townName;

    /**
     * 镇街购买指标
     */
    private String townIndex;

    // 构造函数
    public LindiPurchaseApplicationTownItem() {
    }

    public LindiPurchaseApplicationTownItem(Long purchaseApplicationId, Long townItemId, String townName, String townIndex) {
        this.purchaseApplicationId = purchaseApplicationId;
        this.townItemId = townItemId;
        this.townName = townName;
        this.townIndex = townIndex;
    }

    // Getter和Setter方法
    public Long getPurchaseApplicationId() {
        return purchaseApplicationId;
    }

    public void setPurchaseApplicationId(Long purchaseApplicationId) {
        this.purchaseApplicationId = purchaseApplicationId;
    }

    public Long getTownItemId() {
        return townItemId;
    }

    public void setTownItemId(Long townItemId) {
        this.townItemId = townItemId;
    }

    public String getTownName() {
        return townName;
    }

    public void setTownName(String townName) {
        this.townName = townName;
    }

    public String getTownIndex() {
        return townIndex;
    }

    public void setTownIndex(String townIndex) {
        this.townIndex = townIndex;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        LindiPurchaseApplicationTownItem that = (LindiPurchaseApplicationTownItem) o;
        return Objects.equals(purchaseApplicationId, that.purchaseApplicationId) &&
                Objects.equals(townItemId, that.townItemId) &&
                Objects.equals(townName, that.townName) &&
                Objects.equals(townIndex, that.townIndex);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), purchaseApplicationId, townItemId, townName, townIndex);
    }

    @Override
    public String toString() {
        return "LindiPurchaseApplicationTownItem{" +
                "purchaseApplicationId=" + purchaseApplicationId +
                ", townItemId=" + townItemId +
                ", townName='" + townName + '\'' +
                ", townIndex='" + townIndex + '\'' +
                '}';
    }

    // Builder模式
    public static Builder builder() {
        return new Builder();
    }

    public static class Builder {
        private Long purchaseApplicationId;
        private Long townItemId;
        private String townName;
        private String townIndex;

        public Builder purchaseApplicationId(Long purchaseApplicationId) {
            this.purchaseApplicationId = purchaseApplicationId;
            return this;
        }

        public Builder townItemId(Long townItemId) {
            this.townItemId = townItemId;
            return this;
        }

        public Builder townName(String townName) {
            this.townName = townName;
            return this;
        }

        public Builder townIndex(String townIndex) {
            this.townIndex = townIndex;
            return this;
        }

        public LindiPurchaseApplicationTownItem build() {
            return new LindiPurchaseApplicationTownItem(purchaseApplicationId, townItemId, townName, townIndex);
        }
    }

}
